package com.liufei1988.design.singleton;

import java.util.concurrent.atomic.AtomicLong;

/**
 * 恶汉式
 */
public class HanStyle {
    private AtomicLong id=new AtomicLong(0);
    private static final HanStyle hanStyle=new HanStyle();
    private HanStyle(){}
    public static HanStyle getInstance(){
        return hanStyle;
    }
    public long getId(){
        return id.incrementAndGet();
    }
}
